import {get } from '@/utils/request'

// 新闻列表接口
export var newsList = query => {
    return new Promise((res, rej) => {
        get('/index.php/index/news/newsList', query)
            .then(val => {
                res(val)
            })
            .catch(err => {
                rej(err)
            })
    })
}

// 添加新闻接口
export var addNews = query => {
    return new Promise((res, rej) => {
        get('/index.php/index/news/addNews', query)
            .then(val => {
                res(val)
            })
            .catch(err => {
                rej(err)
            })
    })
}

// 删除新闻
export var delNews = query => {
    return new Promise((res, rej) => {
        get('/index.php/index/news/delNews', query)
            .then(val => {
                res(val)
            })
            .catch(err => {
                rej(err)
            })
    })
}

// 点赞新闻接口
export var addNum = query => {
    return new Promise((res, rej) => {
        get('/index.php/index/news/addNum', query)
            .then(val => {
                res(val)
            })
            .catch(err => {
                rej(err)
            })
    })
}

// 查看新闻详情接口
export var getNewsByid = query => {
    return new Promise((res, rej) => {
        get('/index.php/index/news/getNewsByid', query)
            .then(val => {
                res(val)
            })
            .catch(err => {
                rej(err)
            })
    })
}